version: '3.8'

services:
  streamlit-app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: oss-chatbot-streamlit
    ports:
      - "8505:8501"
    volumes:
      # Mount code for development (hot-reload)
      - ./config:/app/config:ro
      - ./src:/app/src:ro
      - ./personas.json:/app/personas.json:ro
      - ./ui.py:/app/ui.py:ro

      # Volume for persistent data
      - ./data:/app/data
    environment:
      # Ollama configuration (host machine)
      - OLLAMA_HOST=http://host.docker.internal:11434
      # Streamlit configuration
      - STREAMLIT_SERVER_HEADLESS=true
      - STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
      # Path for FAISS index (persistent volume)
      - FAISS_INDEX_PATH=/app/data/embeddings/faiss_index
    extra_hosts:
      # Allow access to Ollama on host
      - "host.docker.internal:host-gateway"
    networks:
      - workshop-network
    restart: unless-stopped
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:8501/_stcore/health" ]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s

networks:
  workshop-network:
    driver: bridge
